package Coding.Exception;

/**
 * 程序
 *  真正处理这个问题
 */
public class PersonThrowS {
    public int getAge() {
        return age;
    }

    int age;

    public void setAge(int age)  throws java.lang.Exception {
        if (age<0 || age>100){
            throw new java.lang.Exception();
        }
        this.age = age;
    }
}

class Throws{

    public static void main(String[] args) {


        PersonThrowS personS = new PersonThrowS();


        try {
            personS.setAge(10000);
        } catch (java.lang.Exception e) {
            e.printStackTrace();
        }

        System.out.println("此人年龄" + personS.getAge());
    }
}
